package com.smart.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.smart.entity.Goods;
import com.smart.entity.Orders;
import com.smart.mapper.OrdersMapper;
import com.smart.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrdersServiceImpl implements OrdersService {

    @Autowired
    OrdersMapper ordersMapper;

    @Override
    public List<Orders> OrdersAll() {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("orders_number", "orders_uid","orders_money","orders_status", "orders_remark", "orders_date");
        List<Orders> ordersList = ordersMapper.selectList(null);
        System.out.println(ordersList);
        return ordersList;
    }

    @Override
    public List<Orders> OrdersSuccess() {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("orders_number", "orders_uid","orders_money","orders_status", "orders_remark", "orders_date");
        queryWrapper.eq("orders_status",1);
        List<Orders> ordersList = ordersMapper.selectList(queryWrapper);
        System.out.println(ordersList);
        return ordersList;
    }

    @Override
    public List<Orders> OrdersWait() {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("orders_number", "orders_uid","orders_money","orders_status", "orders_remark", "orders_date");
        queryWrapper.eq("orders_status",2);
        List<Orders> ordersList = ordersMapper.selectList(queryWrapper);
        System.out.println(ordersList);
        return ordersList;
    }

    @Override
    public List<Orders> OrdersAbnormal() {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("orders_number", "orders_uid","orders_money","orders_status", "orders_remark", "orders_date");
        queryWrapper.eq("orders_status",3);
        List<Orders> ordersList = ordersMapper.selectList(queryWrapper);
        System.out.println(ordersList);
        return ordersList;
    }

    @Override
    public List<Orders> OrdersRefund() {
        QueryWrapper<Orders> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("orders_number", "orders_uid","orders_money","orders_status", "orders_remark", "orders_date");
        queryWrapper.eq("orders_status",4);
        List<Orders> ordersList = ordersMapper.selectList(queryWrapper);
        System.out.println(ordersList);
        return ordersList;
    }
}
